package com.linsir.core;

import com.jagregory.shiro.freemarker.ShiroTags;
import com.linsir.template.tag.DictSelectDirective;
import freemarker.template.Configuration;
import freemarker.template.TemplateException;
import org.springframework.web.servlet.view.freemarker.FreeMarkerConfigurer;

import java.io.IOException;

/**
 * @author ：linsir
 * @date ：Created in 2021/6/30 15:58
 * @description：Freemark 标签配置扩展
 * @modified By：
 * @version: 1.0.0
 */

public class FreeMarkerConfigExtend extends FreeMarkerConfigurer {



    @Override
    public void afterPropertiesSet() throws IOException, TemplateException {
        super.afterPropertiesSet();
        Configuration cfg = this.getConfiguration();
        // 添加shiro标签
        cfg.setSharedVariable("shiro", new ShiroTags());
        cfg.setSharedVariable("dictSelect",new DictSelectDirective());
    }
}
